import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';

import {Backend} from '../../providers/backend';
import {ImagePipe} from '../../pipes/pipes';
@Component({
  templateUrl: 'build/pages/tab-events/tab-previous-article.html',
  pipes: [ImagePipe],
})
export class TabArticle {

  static get parameters() {
    return [[NavController], [NavParams], [Backend]];
  }

  constructor(nav, params, backend) {
    this.nav = nav;
    this.title = params;
    this.backend = backend;
   
    this.result={};
    console.log(params.data.item);
    this.item = params.get('item').item;
    this.title = params.get('item').title;
    this.id = params.get('item').id;
    console.log(this.id);

    this.backend.dsFind({
      e: params.data.item.item.id + '-timelineEvent-edit'
    }).then((result) => {
      console.log(result);
      if(this.id == 1){
        this.result = result.overview;
      }else{
        this.result = result.product;
      }
      console.log(this.result);
      // loading.dismiss();
    });
  }

}